<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/2/9
  Time: 12:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/materialdesignicons.min.css" rel="stylesheet">
    <link href="/css/style.min.css" rel="stylesheet">
    <link href="/layui/css/layui.css" rel="stylesheet">
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <script type="text/javascript" src="/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="/js/main.min.js"></script>
    <script type="text/javascript" src="/layui/layui.js"></script>
</head>
<body>
<div class="container-fluid p-t-15">
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-toolbar clearfix">
                    <table class="table table-bordered" id="messageList" lay-filter="table1"></table>
                    <div id="page1"></div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/html" id="toolbar1">
    <div class="btn-group">
        <button class="btn btn-primary m-r-5" lay-event="show">查看</button>
    </div>
</script>
<script type="text/javascript">
    layui.use(["table","layer"],function () {
        var table=layui.table;
        var layer=layui.layer;
        var form=layui.form;
        table.render({
            elem:'#messageList',
            skin:'row,line',
            method:"post",
            url:'/message/getAllMessage.action',
            where:{},
            limit:5,
            page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
                layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip']//自定义分页布局
                ,limits:[5,10,15]
                ,first: '首页' //不显示首页
                ,last:"尾页" //不显示尾页
            },
            skin:'nob',// 无边框风格
            size:'lg',// 大尺寸
            done:function () {
                $(".layui-table-box").css("border-width","1px");
                $(".layui-table-header tr").css("height","50px");
                $(".layui-table-header tr td").css("width","50px");
                $(".layui-table-header tr").css("background-color","white");
                $(".layui-table-header tr span").css("color","#666666");
                $(".layui-table-body tr").css("height","50px");
            },
            cols:[[
                {field:'mid',title:'公告编号',sort:true,align:'center',width:140},
                {field:'mtitle',title:'公告标题',align:'center',width:200},
                {field:'levelName',title:'发布者身份',sort:true,align:'center',width:160},
                {field:'userNo',title:'发布者工号',sort:true,align:'center',width:140},
                {field:'time',title:'时间',sort:true,align:'center',width:260},
                {title:'操作',toolbar:"#toolbar1",align:'center'}
            ]]
        });
        table.on('tool(table1)', function(obj){
            var data = obj.data; //获得当前行数据
            var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
            var tr = obj.tr; //获得当前行 tr 的 DOM 对象（如果有的话）
            if(layEvent === 'show') {
                layer.open({
                    type:1,
                    title:data.mtitle+'  '+data.time,
                    area: ['400px', '400px'],
                    content:''+data.mess
                })
            }
        });


    })

</script>
</body>
</html>

